package net.tolkv.test.util;

import net.tolkv.tdd.Book;

public class BookBuilder {
	Book book;

	public BookBuilder() {
		super();
		book=new Book("tmp");
	}
	
	public BookBuilder withPrice(int price){
		book.setPrice(price);
		return this;
	}
	
	public BookBuilder withAuthor(String author){
		book.setAuthor(author);
		return this;
	}

	public BookBuilder withTitle(String title){
		book.setTitle(title);
		return this;
	}

	public BookBuilder withYear(String year){
		book.setDate(year);
		return this;
	}
	public BookBuilder withPublisher(String publisher){
		book.setPublisher(publisher);
		return this;
	}
	
	public Book buildBookOne(){
		book.setAuthor("One author");
		book.setTitle("One title");
		book.setPublisher("One publisher");
		book.setDate("One date");
		return book;
	}
	public Book buildBookWithTemplate(String template){
		book.setAuthor(template+"author");
		book.setTitle(template+"One title");
		book.setPublisher(template+"One publisher");
		book.setDate(template+"One date");
		return book;
	}
	public Book build(){
		Book ret = buildNewBook();
		return ret;
	}

	private Book buildNewBook() {
		Book ret=new Book(book.getAuthor());
		ret.setTitle(book.getTitle());
		ret.setPublisher(book.getPublisher());
		ret.setDate(book.getDate());
		ret.setPrice(book.getPrice());
		ret.setId(book.getId());
		return ret;
	}
	
	

}
